package com.sdvdxl.model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sdvdxl.util.GlobalVars;

public class PaggerEntity<T> {
	private int offset;// 偏移量
	private int pageSize;// 分页大小
	private int recordSize;// 总记录数
	private int curPage = 1;// 当前页 默认为1
	private int totalPageSize;// 总页数
	private List<T> targetEntities;//要处理的实体
	private Map<String, Object> params = new HashMap<String, Object>();//参数
	
	public Map<String, Object> getParams() {
		return params;
	}

	public void setParams(Map<String, Object> params) {
		this.params = params;
	}

	public PaggerEntity() {
		this.pageSize = GlobalVars.getInstance().getPageSize();
	}

	public int getOffset() {
		return offset;
	}

	public void setOffset(int offset) {
		this.offset = offset;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getRecordSize() {
		return recordSize;
	}

	public void setRecordSize(int recordSize) {
		this.recordSize = recordSize;
	}

	public int getCurPage() {
		return curPage;
	}

	public void setCurPage(int curPage) {
		this.curPage = curPage;
		this.offset = (this.curPage-1) * this.pageSize;
	}

	public int getTotalPageSize() {
		return totalPageSize;
	}

	public void setTotalPageSize(int totalPageSize) {
		this.totalPageSize = totalPageSize;
	}

	public List<T> getTargetEntities() {
		return targetEntities;
	}

	public void setTargetEntities(List<T> targetEntities) {
		this.targetEntities = targetEntities;
	}

	public void appendParams(String key, Object value) {
		this.params.put(key, value);
	}

}
